<template>
	<view>
		<view>
			<u-cell-group>
				<view class="company_cont" v-for="(item,index) in list" :key="index">
					<view class="pany_img">
						<u-avatar :src="item.img" size="50"></u-avatar>
					</view>
					<view class="pany_cont" @click="radioChange(item)">
						<u-cell-item :title="item.name" :arrow="false" active-color="#EFAB00">
							<u-radio-group v-model="value" width="100%" @change="radioGroupChange">
								<u-radio :name="item.name" shape="circle" @change="radioChange(item)"></u-radio>
							</u-radio-group>
						</u-cell-item>
					</view>
				</view>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	import {
		getBroker
	} from '@/api/strategy.js'
	export default {
		data() {
			return {
				value: '',
				list: ''
			}
		},
		onShow() {
			getBroker().then(res => {
				this.list = res.data
				getApp().globalData.dealData = uni.getStorageSync('globalDataCom');
				let valuestg = uni.getStorageSync('globalDataCom')
				this.value = valuestg.name
			})
		},
		mounted() {

		},
		methods: {
			// 选中某个单选框时，由radio时触发
			radioChange(e) {
				getApp().globalData.dealData = e
				uni.setStorageSync('globalDataCom', e);
				uni.setStorageSync('comLogin', e);
				uni.redirectTo({
					url: '../dealLogin'
				})
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				// e
			}
		}
	}
</script>

<style lang="scss" scoped>
	.company_cont {
		display: flex;

		.pany_img {
			flex: 0.15;
			display: flex;
			justify-content: center;
			align-items: center;
            border-bottom:1px solid #efefef ;    
			.imga {
				width: 40px !important;
				height: 40px !important;
			}
		}

		.pany_cont {
			flex: 0.85;
		}
	}

	.u-radio-group {
		width: 100%;
	}

	.u-radio {
		justify-content: flex-end;
	}
</style>
